﻿using System;
using PropertyExpression.ControllableQuery.Test;

namespace PropertyExpression.ControllableQuery.Toolkit.Test.Queries
{
    public interface IError2QueryInfo
    {
        Guid PublicationId { get; }
        NVarChar<L4000> ModelCode { get; }
        NVarChar<L4000> ModelSequence { get; }
    }

    public class Error2Query : IQuery<IError2QueryInfo>
    {
        private readonly IParam<string> modelCode;

        public Error2Query(IParam<string> modelCode)
        {
            this.modelCode = modelCode;
        }

        public string TransformText()
        {
            return new Q(@"SELECT
    ModelPublication.PublicationId,
    ModelPublication.ModelCode,
    ModelPublication.ModelSequence
FROM
    ModelPublication
WHERE
    ModelPublication.ModelCode = ")._(modelCode)._(@"
    AND ModelPublication.ModelCode = ")._(modelCode).ToString();
        }
    }
}
